package com.example.anql.common;

public class ReturnUtil {
    public static ReturnObject success(Object o){
        ReturnObject ro = new ReturnObject();
        ro.setCode(200);
        ro.setSuccess(true);
        ro.setData(o);
        return ro;
    }

    public static ReturnObject success(String msg){
        ReturnObject ro = new ReturnObject();
        ro.setCode(200);
        ro.setSuccess(true);
        ro.setMsg(msg);
        return ro;
    }

    public static ReturnObject success(){
        ReturnObject ro = new ReturnObject();
        ro.setCode(200);
        ro.setSuccess(true);
        return ro;
    }

    public static ReturnObject fail(){
        ReturnObject ro = new ReturnObject();
        ro.setSuccess(false);
        return ro;
    }

    public static ReturnObject error(String msg){
        ReturnObject ro = new ReturnObject();
        ro.setSuccess(false);
        ro.setCode(400);
        ro.setMsg(msg);
        return ro;
    }
}
